﻿package blizzard.collectible{	import blizzard.BRGameState;		import caurina.transitions.Tweener;		import flash.events.Event;		import flyte.core.Collectible;	import flyte.events.CollectionEvent;	import flyte.events.GameEvent;	import flyte.sound.SoundManager;

	public class Fishmark extends flyte.core.Collectible	{		public function Fishmark()		{			event.when(CollectionEvent.COLLECTED,onCollected)			event.onReadyDo(function():void			{				self.id = "fishmark:("+Math.round(self.x).toString()+","+Math.round(self.y).toString()+")"				if(BRGameState(world.game.state).worldState.collected[self.id] == true && false)				{					collected = true					visible = false				}			})		}				private function onCollected(e:CollectionEvent):void		{			flyte.sound.SoundManager.playSound(CoinClink,true)			BRGameState(world.game.state).worldState.collected[self.id] = true			var towardsHero:Function = function(e:flash.events.Event):void			{				self.x += (world.hero.x - self.x) / 2				self.y += (world.hero.y - self.y) / 2				if(Math.sqrt(Math.pow(world.hero.x - self.x , 2) + Math.pow(world.hero.y - self.y , 2)) < 0.1)				{					event.onLoopDont(towardsHero)					visible = false				}			}						event.onLoopDo(towardsHero)		}	}}